<template>
    <div>
            <Card>
                <p slot="title">
				    编辑车源
			    </p>
                <div>
                    <Form class="step-form" ref="carsourceData" :model="carsourceData" :rules="carsourceDataRules" :label-width="100">
                        <Row span="12">
                            <i-col span="8" >
                                <FormItem prop="brandId" label="品牌名称：" label-position="left" :label-width="150">
                                     <Input :disabled="true" v-model="carsourceData.brand" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                            <i-col span="8" >
                                <FormItem prop="brandId" label="品牌车系：" label-position="left" :label-width="150">
                                    <Input :disabled="true" v-model="carsourceData.series" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem prop="brandId" label="汽车车型：" label-position="left" :label-width="150">
                                    <Input :disabled="true" v-model="carsourceData.model" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="规格：" prop="img_title" label-position="left" :label-width="150">
                                    <Input :disabled="true" v-model="carsourceData.specification" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="指导价：" prop="img_title" label-position="left" :label-width="150">
                                    <Input :disabled="true" v-model="carsourceData.guidance_PRICE" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="成交价格：" prop="img_title" label-position="left" :label-width="150">
                                    <Input :disabled="true" v-model="carsourceData.price" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12" v-show="isPXJK==0">
                            <i-col span="12" >
                                <FormItem label="报价设置：" prop="priceValue" label-position="left" :label-width="150">
                                    <Radio-group  v-model="carsourceData.priceType">
                                        <Radio :label="0" :value="0">直接报价</Radio>
                                        <Radio :label="1" :value="1">优惠金额</Radio>
                                        <Radio :label="2" :value="2">优惠点数</Radio>
                                    </Radio-group>
                                     <Input v-model="carsourceData.priceValue" @on-change="setPriceValue" number placeholder="金额不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="车架号后四位：" prop="img_title" label-position="left" :label-width="150">
                                    <Input :disabled="false" v-model="carsourceData.vin" type="text" placeholder="数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="24" >
                                <FormItem label="外观颜色：" prop="" label-position="left" :label-width="150">
                                    <Row>
                                        <Radio-group v-model="carsourceData.out_COLOR">
                                            <Radio v-for="(item,index) in outColorList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                        </Radio-group>
                                    </Row>
                                    <Row span="12">
                                        <Col span="3">
                                            <Checkbox v-model="location_waiguan">自定义内饰颜色</Checkbox>
                                        </Col>
                                        <Col span="7">
                                            <Input :maxlength="15"  :disabled="!location_waiguan" v-model="carsourceData.out_COLOR" type="text" placeholder="内饰颜色" />
                                        </Col>
                                     </Row>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="24" >
                                <FormItem label="内饰颜色：" prop="" label-position="left" :label-width="150">
                                    <Row>
                                        <Radio-group v-model="carsourceData.in_COLOR">
                                            <Radio v-for="(item,index) in inColorList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                        </Radio-group>
                                    </Row>
                                    <Row span="12">
                                        <Col span="3">
                                            <Checkbox v-model="location_neishi">自定义内饰颜色</Checkbox>
                                        </Col>
                                        <Col span="7">
                                            <Input :maxlength="15"  :disabled="!location_neishi" v-model="carsourceData.in_COLOR" type="text" placeholder="内饰颜色" />
                                        </Col>
                                     </Row>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="期车/现车：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.car_STATUS">
                                        <Radio v-for="(item,index) in carStatus" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="手续情况：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.procedures">
                                        <Radio v-for="(item,index) in proceduresList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="可售区域：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.sell_AREA">
                                        <Radio v-for="(item,index) in sellAreaList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="6" >
                                <FormItem prop="brandId" label="车源所在地：" label-position="left" :label-width="150">
                                    <Select style="width:200px" label-in-value >
                                        <Option @click.native="setArea(item)" v-for="(item,index) in areaList" :value="item.cityCode" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="5" >
                                <FormItem prop="brandId" label="" label-position="left" :label-width="0">
                                    <Select clearable style="width:200px" v-model="carsourceData.car_LOCATION" >
                                        <Option v-for="(item,index) in areaCityList" :value="item.cityName" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="结束时间：" label-position="left" :label-width="150">
                                   <Date-picker v-model="carsourceData.end_TIME" type="datetime" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期和时间" style="width: 200px" @on-change="carsourceData.end_TIME=$event"></Date-picker>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="车源所在地-自定义：" label-position="left" :label-width="150">
                                    <Checkbox style="margin: 0 auto;" v-model="location_check">
                                    </Checkbox>
                                     <Input  :disabled="!location_check" v-model="carsourceData.car_LOCATION" type="text" placeholder="请输入自定义地址" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="3">
                                <FormItem label="车源图片：" prop="img_url" label-position="left" :label-width="150">
                                </FormItem>
                            </i-col>
                            <i-col span="20">
                                <template>
                                    <div class="demo-upload-list" v-for="item in uploadList">
                                        <template v-if="item.status === 'finished'">
                                            <img :src="item.url">
                                            <div class="demo-upload-list-cover">
                                                <Icon type="ios-eye-outline" @click.native="handleView(item.url)"></Icon>
                                                <Icon type="ios-trash-outline" @click.native="handleRemove(item)"></Icon>
                                            </div>
                                        </template>
                                        <template v-else>
                                            <Progress v-if="item.showProgress" :percent="item.percentage" hide-info></Progress>
                                        </template>
                                    </div>
                                    <Upload
                                        ref="upload"
                                        :show-upload-list="false"
                                        :default-file-list="defaultList"
                                        :on-success="handleSuccess"
                                        :format="['jpg','jpeg','png']"
                                        :max-size="2048"
                                        :on-format-error="handleFormatError"
                                        :on-exceeded-size="handleMaxSize"
                                        :before-upload="handleBeforeUpload"
                                        multiple
                                        type="drag"
                                        action="//jsonplaceholder.typicode.com/posts/"
                                        style="display: inline-block;width:58px;">
                                        <div style="width: 58px;height:58px;line-height: 58px;">
                                            <Icon type="camera" size="20"></Icon>
                                        </div>
                                    </Upload>
                                    <Modal title="查看图片" v-model="visible">
                                        <img :src="imgViewUrl" v-if="visible" style="width: 100%">
                                    </Modal>
                                </template>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="提车时间：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.pick_TIME">
                                        <Radio v-for="(item,index) in pickTimeList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="票据来源：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.invoice_SOURCE">
                                        <Radio v-for="(item,index) in invoiceSourceList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="开票方式：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.invoice_TYPE">
                                        <Radio v-for="(item,index) in invoiceTypeList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="生产日期：" prop="" label-position="left" :label-width="150">
                                   <Radio-group v-model="carsourceData.product_TIME">
                                        <Radio v-for="(item,index) in productTimeList" :value="item.value" :key="index" :label="item.value">{{item.value}}</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="备注：" prop="" label-position="left" :label-width="150">
                                   <Input v-model="carsourceData.remarks" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入..."></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        
                        <FormItem >
                            <Button :disabled="hasSubmit" @click="editData" style="width:100px;" type="primary">提交</Button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <Button :disabled="hasSubmit" @click="goBack" style="width:100px;" >返回</Button>
                        </FormItem>
                    </Form>
                </div>
            </Card>
    </div>
</template>

<script>
import ajax from '../../../libs/axios.js'
export default {
    name: 'addUser',
    data () {
        return {
            id:'',
            defaultList: [],
            imgName: '',
            imgUrl:'',
            imgViewUrl:'',
            visible: false,
            uploadList: [],
            testModelShow:false,
            symptomList:[],
            selectModel:[],
            brandList:[],
            seriesList:[],
            modelsList:[],
            areaList:[],
            areaCityList:[],
            carStatus:[],
            proceduresList:[],
            sellAreaList:[],
            pickTimeList:[],
            invoiceSourceList:[],
            invoiceTypeList:[],
            productTimeList:[],
            outColorList:[],
            inColorList:[],
            location_check:false,
            location_waiguan:false,
            location_neishi:false,
            jklxList:['中东','加版','墨版','欧版','美版'],
            isPXJK:0,//判断是否为平行进口
            carsourceInfo: {
                imgs:[],
                BRAND:'',//品牌
                SERIES:'',//车系
                MODEL:'',//车型
                MODEL_ID:'',//车型Id
                CAR_YEAR:'',//年款
                PL:'',//排量
                OUT_COLOR:'',//外观颜色
                IN_COLOR:'',//内饰颜色
                SPECIFICATION:'',//规格
                CAR_LOCATION:'',//车源所在地
                GUIDANCE_PRICE:'',//指导价
                PRICE:0,//成交价
                DISCOUNT_AMT:0,//优惠金额
                ADD_AMT:0,//加价金额
                ADD_POINT:0,//加价点数
                DISCOUNT_POINT:0,//优惠点数
                VIN:'',//车架号后四位
                CAR_STATUS:'',// 期车/现车
                PROCEDURES:'',//手续
                SELL_AREA:'',//销售区域
                PICK_TIME:'',//提车时间
                INVOICE_SOURCE:'',//票据来源
                INVOICE_TYPE:'',//开票方式
                PRODUCT_TIME:'',//生产日期
                REMARKS:''//备注
            },
            carsourceData: {
                brandId:'',
                brandValue:'',
                seriesValue:'',
                seriesId:'',
                modelValue:'',
                modelId:'',
                imgs:[],
                add_AMT: 0,
                add_POINT: 0,
                brand: "阿尔法罗密欧",
                car_LOCATION: "天津市",
                car_STATUS: "期车",
                car_YEAR: "2019款",
                create_TIME: "2019-07-31 15:23:38",
                discount_AMT: 0,
                discount_POINT: 0,
                guidance_PRICE: 37.98,
                id: "741c4393efe04137b2f65859686db718",
                in_COLOR: "黑",
                invoice_SOURCE: "均可",
                invoice_TYPE: "增票",
                is_HOT: 0,
                model: "Giulia 2019款 2.0T 280HP 豪华版",
                model_ID: "567DxrrM",
                num: 1,
                out_COLOR: "白",
                pick_TIME: "三天内",
                pl: "2.0",
                price: 37.98,
                procedures: "三天内",
                product_TIME: "一年内",
                remarks: "asdasdasdasd",
                sell_AREA: "东区",
                end_TIME:'',
                series: "Giulia",
                specification: "中规",
                status: 0,
                type: 1,
                vin: "1234",
                priceType:0,
                priceValue:0,
                img_link:'',//车源所在地
                skip_type:1,
                is_enable:0,
                img_url: '',
                num:1,
                type:1
            },
            carsourceDataRules: {
                // brandId: [
                //     { required: true, message: '品牌不能设置为空', trigger: 'blur'}
                // ],
                priceValue:[
                   // { required: true, message: '数据不能为空', trigger: 'blur'}
                   // { message: '最小分只能是数字', trigger:'change', pattern:/^(([1-9]\d{0,3})|0)(\.\d{0,2})?$/,}
                ]
                // 暂时不进行验证
                // imgUrl: [
                //     { required: true, message: '请上传疾病图片', trigger: 'blur'},
                // ]
                
            },
            hasSubmit: false,
            // 图片上传
            file: null,
            status: 'wait'
        }
    },
    methods: {
        // 数据初始化
        init () {
            this.$store.commit('setActiveName', 'realcarindex');
            let id = this.$route.params.id;
            this.id = id;
            //this.getCarBrands();
            this.selectBaseInfos();
            
        },
        getInfoById(id){
            let _that = this;
            let url = 'adminlogin/carsource/selectById'
            let data = {
                id: id
            }
            ajax.formRes(url, data).then(res => {
                // success
                _that.carsourceData = res.data;
                
                _that.jklxList.indexOf(res.data.specification)>=0?_that.isPXJK=1:_that.isPXJK=0;
                //_that.uploadList = res.pictures;
                _that.uploadList = res.pictures;
                

            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        handleView (url) {
            this.imgViewUrl = url;
            this.visible = true;
        },
            handleRemove (file) {
                // 从 upload 实例删除数据
                // const fileList = this.$refs.upload.fileList;
                // debugger;
                // this.$refs.upload.fileList.splice(fileList.indexOf(file), 1);
                if(file.fileType == 1){
                    this.uploadList.splice(this.uploadList.indexOf(file),1);
                }else{
                    //删除持久层图片信息
                    let _that = this;
                    let url = '/adminlogin/carsource/deletePictureById'
                    let data = {
                        id:file.name
                    }
                    ajax.formRes(url, data).then(res => {
                        debugger;
                        if(res.code == 200){
                            _that.uploadList.splice(_that.uploadList.indexOf(file),1);
                        }
                        
                    }).catch(res => {
                        console.log('有错误信息')
                        // fail
                    })
                }
            },
            handleSuccess (res, file) {
                // 因为上传过程为实例，这里模拟添加 url
                file.url = this.imgUrl;
                file.name = this.imgName;
                file.fileType = 1;
                this.uploadList.push(file);
                
            },
            handleFormatError (file) {
                this.$Notice.warning({
                    title: '文件格式不正确',
                    desc: '文件 ' + file.name + ' 格式不正确，请上传 jpg 或 png 格式的图片。'
                });
            },
            handleMaxSize (file) {
                this.$Notice.warning({
                    title: '超出文件大小限制',
                    desc: '文件 ' + file.name + ' 太大，不能超过 2M。'
                });
            },
            handleBeforeUpload (file) {
                const check = this.uploadList.length < 9;
                if (!check) {
                    this.$Notice.warning({
                        title: '最多只能上传 9 张图片。'
                    });
                }else{
                    this.uploadType = 1
                    this.file = file
                    this.upload()
                }
                return check;
            },
        setBrand(obj){
            this.carsourceData.brandId=obj.value;
            this.carsourceData.brandValue=obj.label;
            this.carsourceData.BRAND=obj.label;
            this.getCarSeries(obj.value);
            
        },
        setCarSeries(obj){//设置车系
            this.carsourceData.seriesId=obj.value;
            this.carsourceData.seriesValue=obj.label;
            this.carsourceData.SERIES = obj.label;
            this.getCarModels(obj.value);
            
        },
        setPriceValue(value){//设置金额
            // console.log("***********************",this.carsourceData.priceValue)
            // console.log("*************类型**********",this.carsourceData.priceType)
            // console.log("*************是否是数据**********",typeof this.carsourceData.priceValue === 'number' && !isNaN(this.carsourceData.priceValue))
            // ;
            let pValue = this.carsourceData.priceValue;
            if(typeof pValue === 'number' && !isNaN(pValue)){
                if(this.carsourceData.priceType == 0){
                    this.carsourceData.price = pValue
                }else if(this.carsourceData.priceType == 1){
                    if(pValue>0){
                        this.carsourceData.discount_AMT = pValue;
                    }else{
                        this.carsourceData.add_AMT = pValue;
                    }
                    this.carsourceData.price = (this.carsourceData.guidance_PRICE - pValue).toFixed(2);
                }else if(this.carsourceData.priceType == 2){
                    if(pValue>=0){
                        this.carsourceData.discount_POINT = pValue;
                    }else{
                        this.carsourceData.add_POINT = pValue;
                    }
                    this.carsourceData.price = (this.carsourceData.guidance_PRICE - this.carsourceData.guidance_PRICE*pValue/10).toFixed(2);
                }
            }else{
                this.$Notice.warning({
                    title: '请输入数字格式的数据。'
                });
            }
        },
        setcarModels(item){
            this.carsourceData.modelId = item.modelId;
            this.carsourceData.modelValue = item.modelName;
            this.carsourceData.MODEL=item.modelName;
            this.carsourceData.MODEL_ID=item.modelId;
            this.carsourceData.CAR_YEAR=item.carYear;
            this.carsourceData.PL=item.pl;
            this.carsourceData.SPECIFICATION = item.jklx;
            this.carsourceData.GUIDANCE_PRICE = item.guidancePrice;
            this.carsourceData.PRICE = item.guidancePrice;
            this.carsourceData.priceValue = item.guidancePrice;
            
        },
        getCarModels(seriesId){
            let _that = this;
            let url = '/adminlogin/car/getCarModelsBySeriesId'
            let data = {
                seriesId:seriesId
            }
            ajax.formRes(url, data).then(res => {
                _that.modelsList = res.data;
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        getCarSeries(brandId){
            let _that = this;
            let url = '/adminlogin/car/getCarSeriesByBrandId'
            let data = {
                brandId:brandId
            }
            ajax.formRes(url, data).then(res => {
                _that.seriesList = res.data;
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        getCarBrands(){
            let _that = this;
            let url = '/adminlogin/car/getCarBrands'
            let data = {
            }
            ajax.formRes(url, data).then(res => {
                _that.brandList = res.data;
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        selectBaseInfos(){//获取区域信息
            let _that = this;
            let url = '/adminlogin/carsource/selectBaseInfos'
            let data = {
            }
            ajax.formRes(url, data).then(res => {
                _that.areaList = res.area;
                _that.carStatus=res.carStatus;
                _that.proceduresList=res.procedures;
                _that.sellAreaList = res.sellArea;
                _that.pickTimeList = res.pickTime;
                _that.invoiceSourceList = res.invoiceSource;
                _that.invoiceTypeList=res.invoiceType;
                _that.productTimeList=res.productTime;
                _that.outColorList=res.outColor;
                _that.inColorList=res.inColor;
                _that.getInfoById(_that.id);
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        setArea(obj){
            this.areaCityList = obj.citys;
        },
        // 上传图片
        upload () {
            let that = this
            let fileName = that.file.name
            //FormData 对象
            let formData = new FormData()
            console.log(fileName)
            this.uploadLoading = true
            // 文件对象
            formData.append("img", that.file)
            formData.append("type", "interface")
            ajax.upload('adminlogin/file/uploadOssImage',formData).then(function (res) {
                that.imgUrl = res.url
                that.imgName = res.name
                that.file = ''
                that.$Message.success('上传成功')              
                //that.uploadLoading = false
            }, function (err) {
                console.log(err)
                //this.uploadLoading = false
            }).catch(function (error) {
                console.log(error)
                //this.uploadLoading = false
            })
        },
        // 修改数据
        editData () {
            //设置参数
            let that = this
            let file = this.$refs.upload.fileList;
            this.carsourceData.imgs = JSON.stringify(file);
            let data1 = {
                imgs:JSON.stringify(file),
                ID:that.id,
                BRAND:that.carsourceData.brand,//品牌
                SERIES:that.carsourceData.series,//车系
                MODEL:that.carsourceData.model,//车型
                MODEL_ID:that.carsourceData.model_ID,//车型Id
                CAR_YEAR:that.carsourceData.car_YEAR,//年款
                PL:that.carsourceData.pl,//排量
                OUT_COLOR:that.carsourceData.out_COLOR,//外观颜色
                IN_COLOR:that.carsourceData.in_COLOR,//内饰颜色
                SPECIFICATION:that.carsourceData.specification,//规格
                CAR_LOCATION:that.carsourceData.car_LOCATION,//车源所在地
                GUIDANCE_PRICE:that.carsourceData.guidance_PRICE,//指导价
                PRICE:that.carsourceData.price,//成交价
                DISCOUNT_AMT:that.carsourceData.discount_AMT,//优惠金额
                ADD_AMT:that.carsourceData.add_AMT,//加价金额
                ADD_POINT:that.carsourceData.add_POINT,//加价点数
                DISCOUNT_POINT:that.carsourceData.discount_POINT,//优惠点数
                VIN:that.carsourceData.vin,//车架号后四位
                CAR_STATUS:that.carsourceData.car_STATUS,// 期车/现车
                PROCEDURES:that.carsourceData.procedures,//手续
                SELL_AREA:that.carsourceData.sell_AREA,//销售区域
                PICK_TIME:that.carsourceData.pick_TIME,//提车时间
                INVOICE_SOURCE:that.carsourceData.invoice_SOURCE,//票据来源
                INVOICE_TYPE:that.carsourceData.invoice_TYPE,//开票方式
                PRODUCT_TIME:that.carsourceData.product_TIME,//生产日期
                END_TIME:that.carsourceData.end_TIME,//结束时间
                REMARKS:that.carsourceData.remarks//备注
            }
            that.$refs['carsourceData'].validate((valid) => {
                if (valid) {
                    that.hasSubmit = true
                    let url = 'adminlogin/carsource/updateInfo'
                    ajax.formRes(url, data1).then(res => {
                        // success
                        that.$Message.success('编辑成功,页面正在跳转')
                        that.hasSubmit = false
                            let argu = {
                            }
                            that.$router.push({
                                name: 'interfacecarindex',
                                params: argu
                            })
                    }).catch(res => {
                        console.log('有错误信息')
                        // fail
                    })
                } else {
                    console.log('新增失败。。。')
                }
            })
        },
        goBack () {
            this.$router.push({
                name: 'interfacecarindex'
            })
        },
        // 症状
        hideModel (value) {
            this.testModelShow = false
        },
        addSymptom () {
            // 点击不同按钮传不同的值，此处重新重新回显被选中的值加载网络不好的情况反应会很慢需要加载菊花
            this.$refs.symptomModel.init()
            this.selectModel = this.symptomList
            this.testModelShow = true
        }
        
    },
    mounted () {
        this.init();
        this.uploadList = this.$refs.upload.fileList;
    },
    created: function () {
        
    },
    activated: function () {
        
    }
}
</script>
<style>
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .card-upload:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
    .demo-spin-icon-load{
        animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
        from { transform: rotate(0deg);}
        50%  { transform: rotate(180deg);}
        to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
        height: 100px;
        position: relative;
        border: 1px solid #eee;
    }
    .demo-upload-list{
        display: inline-block;
        width: 60px;
        height: 60px;
        text-align: center;
        line-height: 60px;
        border: 1px solid transparent;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        position: relative;
        box-shadow: 0 1px 1px rgba(0,0,0,.2);
        margin-right: 4px;
    }
    .demo-upload-list img{
        width: 100%;
        height: 100%;
    }
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .demo-upload-list:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
</style>